package com.nativetalk.common.util;

import com.nativetalk.bean.reserve.TdNtReserveTimeList;

import java.util.*;

public class GetTeacherUtil {
    public static List<TdNtReserveTimeList> getReserveTime(Date date, TimeZone clientTimeZone){
        Calendar cal1 = Calendar.getInstance(clientTimeZone);
        cal1.setTime(date);
        // 将时分秒,毫秒域清零
        cal1.set(Calendar.HOUR_OF_DAY, 0);
        cal1.set(Calendar.MINUTE, 0);
        cal1.set(Calendar.SECOND, 0);
        cal1.set(Calendar.MILLISECOND, 0);
        Date newDate = cal1.getTime();
        System.out.println(newDate);
        List<TdNtReserveTimeList> tdNtReserveTimes = new ArrayList<>();
        for (int i = 18; i < 48; i++){
            TdNtReserveTimeList tdNtReserveTime = new TdNtReserveTimeList();
            Date date1 = new Date(newDate.getTime() + i * 60 * 1000 * 30);
            tdNtReserveTime.setDate(date1);
            tdNtReserveTimes.add(tdNtReserveTime);
        }
        for (int i = 0; i < 18; i++){
            TdNtReserveTimeList tdNtReserveTime = new TdNtReserveTimeList();
            Date date1 = new Date(newDate.getTime() + i * 60 * 1000 * 30);
            tdNtReserveTime.setDate(date1);
            tdNtReserveTimes.add(tdNtReserveTime);
        }
        return tdNtReserveTimes;
    }
}
